package spring.sell.aspect;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

@Aspect
@Component
public class SellerAuthorizeAspect {
    @Pointcut("execution(public * spring.sell.controller.Seller*.*(..))" +
    "&& !execution(public * spring.sell.controller.SellerUserController.*(..))"
    )
    public void verify() {

    }

    @Before("verify()")
    public void doVerify() {
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = attributes.getRequest();

        //查询cookie
        /*Cookie cookie = CookieUtil.get(request, CookieConstant.TOKEN);
        if(cookie)*/
    }
}
